package com.rules.admin.unit.expect;

import com.google.common.collect.Lists;

import java.util.List;

public class ActionsHolder {
   public static final ThreadLocal<ActionsHolder> ACTION_HOLDERS = new ThreadLocal();
   private List<String> actions = Lists.newArrayList();

   private static ActionsHolder get() {
      if (ACTION_HOLDERS.get() == null) {
         ACTION_HOLDERS.set(new ActionsHolder());
      }

      return (ActionsHolder)ACTION_HOLDERS.get();
   }

   public static void addAction(String action) {
      get().actions.add(action);
   }

   public static boolean hasAction(String action) {
      return get().actions.contains(action);
   }
}
